package com.funcourse.demo.api.restful.io.response.busi;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.funcourse.demo.model.User;
import org.springframework.beans.BeanUtils;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class MeVO extends User {
  public MeVO(User user){
    super();
    BeanUtils.copyProperties(user,this);
    clearPrivateData();
    this.setToken(user.getToken());
    this.setMobile(user.getMobile());
    if(null != user.getUnionId()){
      this.setUnionId(User.MASK_STRING);
    }
    if(null != user.getWebOpenId()){
      this.setWebOpenId(User.MASK_STRING);
    }
    if(null != user.getWeletOpenId()){
      this.setWeletOpenId(User.MASK_STRING);
    }
  }
}
